//
//  CPSCVideoLectureCollectionViewCell.m
//  CPSCustomer
//
//  Created by codew on 9/2/21.
//  Copyright © 2021 dgg_hzk. All rights reserved.
//

#import "CPSCVideoLectureCollectionViewCell.h"

@interface CPSCVideoLectureCollectionViewCell ()


// ================================================================

/**封面图*/
@property (nonatomic, strong) UIImageView * imageViewCover;
/**标题 */
@property (nonatomic, strong) UILabel * lblSummary;
@property (nonatomic, strong) UILabel * lblName;
// 已经学习
@property (nonatomic, strong) UILabel * lblAlready;

@end

@implementation CPSCVideoLectureCollectionViewCell




- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame])
    {
        [self initSubviews];
        [self makeContraints];
    }
    
    return self;
}



- (void)updateCellWithItem:(id)item
{}


#pragma mark--initUI

- (void)initSubviews {
    self.backgroundColor = [UIColor whiteColor];
    self.layer.cornerRadius = 4;
    self.layer.masksToBounds = YES;
    
    
    [self.contentView addSubview:self.imageViewCover];
    [self.contentView addSubview:self.lblSummary];
    [self.contentView addSubview:self.lblName];
    [self.contentView addSubview:self.lblAlready];
    
    [self deBugUI];
}

- (void)makeContraints {
    
    
    [self.imageViewCover mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.right.mas_equalTo(0);
        make.height.mas_equalTo(100);
    }];
        
    
    [self.lblName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(10);
        make.bottom.mas_equalTo(-13);
    }];
    
    [self.lblAlready mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(-10);
        make.bottom.mas_equalTo(-14);
    }];
    
    [self.lblSummary mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.imageViewCover.mas_bottom).offset(10);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(10);
    }];
    
}

- (void)deBugUI
{
    self.imageViewCover.image = [UIImage imageNamed:@"op"];
    
    self.lblSummary.text = @"我们赖以生存的地球家园正在遭受新一轮的侵袭，点开视频看详情，我知道你会点我们赖以生存的地球家园正在遭受新一轮的侵袭，点开视频看详情，我知道你会点";
    self.lblAlready.text = @"已学99%";
    self.lblName.text = @"吴镇宇";
}
#pragma mark - Getter Setter
- (UILabel *)lblSummary
{
    if (!_lblSummary) {
        
        UILabel * lblZy = [[UILabel alloc] init];
        lblZy.textColor = [UIColor colorWithHexString:@"#1A1A1A"];
        lblZy.font = [UIFont systemFontOfSize:14 weight:1];
        lblZy.textAlignment = NSTextAlignmentLeft;
        lblZy.numberOfLines = 2;
        
        _lblSummary = lblZy;
    }
    
    return _lblSummary;
}
- (UILabel *)lblName
{
    if (!_lblName) {
        
        UILabel * lblZy = [[UILabel alloc] init];
        lblZy.textColor = [UIColor colorWithHexString:@"#555555"];
        lblZy.font = [UIFont systemFontOfSize:12];
        lblZy.textAlignment = NSTextAlignmentLeft;
        
        _lblName = lblZy;
    }
    
    return _lblName;
}


- (UIImageView *)imageViewCover
{
    if (!_imageViewCover) {
        
        UIImageView * imageViewIcon = [[UIImageView alloc] init];
        imageViewIcon.contentMode = UIViewContentModeScaleToFill;
        imageViewIcon.clipsToBounds = YES;
        
        _imageViewCover = imageViewIcon;
    }
    return _imageViewCover;
}

- (UILabel *)lblAlready
{
    if (!_lblAlready) {
        
        UILabel * lblZy = [[UILabel alloc] init];
        lblZy.textColor = [UIColor colorWithHexString:@"#4974F5"];
        lblZy.font = [UIFont systemFontOfSize:10];
        lblZy.textAlignment = NSTextAlignmentLeft;
        
        _lblAlready = lblZy;
    }
    
    return _lblAlready;
}


@end
